/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GUI;

import java.util.Hashtable;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.jfree.chart.ChartPanel;

/**
 *
 * @author kevin
 */
public class CurvePanel extends JPanel {

    /** hashtable store serveral chartpanel */
    protected Hashtable m_AllPanels = new Hashtable();
    /** chart panel */
    JPanel m_RocPanel = new JPanel();
    /**
     * 构造函数
     */
    public CurvePanel(){
        JLabel aucLbl = new JLabel("AUC(Area under the ROC curve): ");
        JButton detailBtn = new JButton("Detail view…");

        this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
        this.add(m_RocPanel);
        this.add(aucLbl);
        this.add(detailBtn);

    }
    /** show curvepanel
     * @param name
     *
     */
    public void ShowCurvePanelByName(String name){
        ChartPanel chartPanel = (ChartPanel) m_AllPanels.get(name);
        m_RocPanel.removeAll();
        m_RocPanel.add(chartPanel);
        m_RocPanel.validate();
        m_RocPanel.repaint();
    }
    /** add chartframepanel
     * @param name
     * @param chart
     */
    public void AddChartFramePanel(String name,ChartPanel chart){
        m_AllPanels.put(name, chart);

    }
    public void RemoveChartPanel(String name){
        m_AllPanels.remove(name);
        System.gc();
    }
    /**
     * return the roc panel
     * @return
     */
    public JPanel GetRocPanel(){
        return m_RocPanel;
    }

}
